package student.stu23002151.chapter10.PYB_SerDeserDemo;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class PYB_SerializeDemo {
    public static void main(String[] args) {
        Student student = new Student("Pei Yibiao", 23);

        try (FileOutputStream fileOut = new FileOutputStream("D:\\____Developer____\\StudyFile\\JavaClassCode\\src\\student\\stu23002151\\chapter10\\PYB_SerDeserDemo\\student.ser1");
             ObjectOutputStream out = new ObjectOutputStream(fileOut)) {
            out.writeObject(student);
            System.out.println("Serialized data is saved in student.ser");
        } catch (IOException i) {
            i.printStackTrace();
        }
    }
}